# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=trixd00r
pkgver=0.0.1
pkgrel=5
groups=('blackarch' 'blackarch-backdoor')
pkgdesc='An advanced and invisible userland backdoor based on TCP/IP for UNIX systems.'
url='http://nullsecurity.net/tools/backdoor.html'
arch=('x86_64' 'aarch64')
license=('custom:unknown')
depends=('libpcap')
source=("https://github.com/nullsecuritynet/tools/raw/main/backdoor/$pkgname/release/$pkgname-$pkgver.tar.gz")
sha512sums=('48b178847daee2ff836f443be471c4b4574f967394a107eecaf558e0469b9f05e6bf8c03bfa459cca3c5b50cd154d34632b6e6ceb5eba46bd82b879d4edcd139')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i 's/LDFLGAS_IRIX/LDFLAGS_IRIX/' Makefile
}

build() {
  cd "$pkgname-$pkgver"

  # We can't build the solaris client.
  # The client should be built for Linux so the 'linux' system must be last in the list.
  for sys in freebsd netbsd openbsd macos aix hpux irix linux ; do
    rm -rf $sys
    make MAKE=make $sys
    mkdir $sys
    mv trixd00rd trixd00rd-$sys
  done
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  install -m 755 trixd00rd-* "$pkgdir/usr/share/$pkgname/"
  install -m 755 $pkgname "$pkgdir/usr/bin"

  install -m 644 docs/* "$pkgdir/usr/share/doc/$pkgname"
}

